import { ref, watch } from 'vue'
import store from './store'
/**
* 数据 hook
* @param initValue 默认值
*/
export function useShopLoad(fn) {
  new Promise(resolve => {
    if (store.state.token) resolve()
    else Vue.prototype.$readyDone = resolve
  })
}

/**
* 数据 hook
* @param initValue 默认值
*/
export function useShopLoad(fn) {
  const shopId = store('shop').info?.id
  watch(shopId, (val) => {
    if (val) fn()
  }, {
    immediate: true
  })
}
